home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / progtool / c / nkcc / nkcc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  11.0 KB  |  295 lines

  1. /*******************************************************************************
  2. *
  3. *  Project name : NORMALIZED KEY CODE CONVERTER (NKCC)
  4. *  Module name  : Global definitions
  5. *  Symbol prefix: nkc
  6. *
  7. *  Author       : Harald Siegmund (HS)
  8. *  Co-Authors   : -
  9. *  Write access : HS
  10. *
  11. *  Notes        : -
  12. *-------------------------------------------------------------------------------
  13. *  Things to do : -
  14. *
  15. *-------------------------------------------------------------------------------
  16. *  History:
  17. *
  18. *  1990:
  19. *     May 23-24: creation of file
  20. *     Jul 09: nkc_kstate()
  21. *     Aug 03: nkc_cmp(); NK_MASK
  22. *     Sep 15: nkc_init(): beflag,vdihnd; BE_...
  23. *             nkc_exit() has now a result
  24. *     Sep 16: nkc_timer()
  25. *     Oct 03: nkc_vlink()/vunlink(); NKXM_...
  26. *     Oct 07: removing NK_MASK (use nkc_cmp() for key code comparism!)
  27. *     Nov 13: NK_LEFT/NK_RIGHT exchanged
  28. *     Dec 11: MU_XTIMER
  29. *  1991:
  30. *     Apr 13: nkc_conv() renamed to nkc_tconv()
  31. *             nkc_gconv()
  32. *             rearranging prototypes
  33. *     May 29: nkc_toupper, nkc_tolower
  34. *     Aug 22: NKS_DEADKEY changed
  35. *             NKS_D_...
  36. *             nkc_set() changed
  37. *             nkc_init() now returns version #
  38. *     Aug 26: NK_INVALID
  39. *     Sep 07: NK_TERM
  40. *     Sep 14: NKF_IGNUM
  41. *     Nov 16: NKS_CTRL
  42. *     Dec 29: NK_RVD...
  43. *  1992:
  44. *     Jan 03: redefining BE_...
  45. *             NKI_...
  46. *             first parameter of nkc_init() is now of type 'unsigned long'
  47. *     Jan 12: NK_TERM: int-cast added
  48. *  1993:
  49. *     Dec 11: new file header
  50. *             adding documentation markers and section headers
  51. *             nkc_toupper() and nkc_tolower() are functions now
  52. *     Dec 12: new: nkc_n2tos(), nkc_n2gem()
  53. *
  54. ***************************************************************************/
  55. /*KEY _NAME="Global NKCC definitions (C language)" */
  56. /*END*/
  57.  
  58. #ifndef __NKCC
  59. #define __NKCC
  60.  
  61.  
  62. /*KEY _END */
  63.  
  64.  
  65. /*******************************************************************************
  66. *                                                                              *
  67. *                                    MACROS                                    *
  68. *                                                                              *
  69. *******************************************************************************/
  70.  
  71. /*START*/
  72.  
  73.    /* flags for NKCC initialization */
  74.  
  75. #define NKI_BUTHND   0x00000001UL   /* install button event handler */
  76. #define NKI_BHTOS    0x00000002UL   /* additional flag: only if TOS has */
  77.                                     /*  mouse click bug */
  78. #define NKI_NO200HZ  0x00000004UL   /* don't install 200 Hz clock interrupt */
  79.                                     /*  (this flag is ignored if the button */
  80.                                     /*  event handler is being activated) */
  81. /*END*/
  82. /*START*/
  83.  
  84.    /* flag combinations for compatibility with old versions of NKCC */
  85.  
  86. #define BE_ON        NKI_BUTHND
  87. #define BE_OFF       0
  88. #define BE_TOS       (NKI_BUTHND | NKI_BHTOS)
  89.  
  90. /*END*/
  91. /*START*/
  92.  
  93.    /* flags for special key code handling */
  94.  
  95. #define NKS_ALTNUM   0x00000001UL   /* Alt + numeric pad -> ASCII */
  96. #define NKS_CTRL     0x00000002UL   /* Control key emulation */
  97.                                     /* deadkey management: */
  98. #define NKS_D_CIRCUM 0x00010000UL   /* ^  accent circumflex */
  99. #define NKS_D_TILDE  0x00020000UL   /* ~  accent tilde */
  100. #define NKS_D_AGUI   0x00040000UL   /* '  accent agui */
  101. #define NKS_D_GRAVE  0x00080000UL   /* `  accent grave */
  102. #define NKS_D_UMLAUT 0x00100000UL   /* ¨  umlaut */
  103. #define NKS_D_QUOTE  0x00200000UL   /* "  quote, synonym for umlaut */
  104. #define NKS_D_SMOERE 0x00400000UL   /* °  smoerebroed */
  105. #define NKS_D_CEDIL  0x00800000UL   /* ,  cedil */
  106. #define NKS_D_SLASH  0x01000000UL   /* /  slash, for scandinavian characters */
  107. #define NKS_DEADKEY  0xffff0000UL   /* all deadkeys */
  108.  
  109. /*END*/
  110. /*START*/
  111.  
  112.    /* NKCC key code flags */
  113.  
  114. #define NKF_FUNC     0x8000         /* function          */
  115. #define NKF_RESVD    0x4000         /* resvd, ignore it! */
  116. #define NKF_NUM      0x2000         /* numeric pad       */
  117. #define NKF_CAPS     0x1000         /* CapsLock          */
  118. #define NKF_ALT      0x0800         /* Alternate         */
  119. #define NKF_CTRL     0x0400         /* Control           */
  120. #define NKF_SHIFT    0x0300         /* any Shift key     */
  121. #define NKF_LSH      0x0200         /* left Shift key    */
  122. #define NKF_RSH      0x0100         /* right Shift key   */
  123.  
  124. #define NKF_IGNUM    NKF_RESVD      /* special flag for nkc_cmp() */
  125.  
  126. /*END*/
  127. /*START*/
  128.  
  129.    /* special key codes for keys performing a function */
  130.  
  131. #define NK_INVALID   0x00           /* invalid key code  */
  132. #define NK_UP        0x01           /* cursor up         */
  133. #define NK_DOWN      0x02           /* cursor down       */
  134. #define NK_RIGHT     0x03           /* cursor right      */
  135. #define NK_LEFT      0x04           /* cursor left       */
  136. #define NK_RVD05     0x05           /* reserved!         */
  137. #define NK_RVD06     0x06           /* reserved!         */
  138. #define NK_RVD07     0x07           /* reserved!         */
  139. #define NK_BS        0x08           /* Backspace         */
  140. #define NK_TAB       0x09           /* Tab               */
  141. #define NK_ENTER     0x0a           /* Enter             */
  142. #define NK_INS       0x0b           /* Insert            */
  143. #define NK_CLRHOME   0x0c           /* Clr/Home          */
  144. #define NK_RET       0x0d           /* Return            */
  145. #define NK_HELP      0x0e           /* Help              */
  146. #define NK_UNDO      0x0f           /* Undo              */
  147. #define NK_F1        0x10           /* function key #1   */
  148. #define NK_F2        0x11           /* function key #2   */
  149. #define NK_F3        0x12           /* function key #3   */
  150. #define NK_F4        0x13           /* function key #4   */
  151. #define NK_F5        0x14           /* function key #5   */
  152. #define NK_F6        0x15           /* function key #6   */
  153. #define NK_F7        0x16           /* function key #7   */
  154. #define NK_F8        0x17           /* function key #8   */
  155. #define NK_F9        0x18           /* function key #9   */
  156. #define NK_F10       0x19           /* function key #10  */
  157. #define NK_RVD1A     0x1a           /* reserved!         */
  158. #define NK_ESC       0x1b           /* Esc               */
  159. #define NK_RVD1C     0x1c           /* reserved!         */
  160. #define NK_RVD1D     0x1d           /* reserved!         */
  161. #define NK_RVD1E     0x1e           /* reserved!         */
  162. #define NK_DEL       0x1f           /* Delete            */
  163.  
  164.                                     /* terminator for key code tables */
  165. #define NK_TERM      ((int)(NKF_FUNC | NK_INVALID))
  166.  
  167. /*END*/
  168. /*START*/
  169.  
  170.    /* ASCII codes less than 32 */
  171.  
  172. #define NUL          0x00           /* Null */
  173. #define SOH          0x01           /* Start Of Header */
  174. #define STX          0x02           /* Start Of Text */
  175. #define ETX          0x03           /* End Of Text */
  176. #define EOT          0x04           /* End Of Transmission */
  177. #define ENQ          0x05           /* Enquiry */
  178. #define ACK          0x06           /* positive Acknowledgement */
  179. #define BEL          0x07           /* Bell */
  180. #define BS           0x08           /* BackSpace */
  181. #define HT           0x09           /* Horizontal Tab */
  182. #define LF           0x0a           /* Line Feed */
  183. #define VT           0x0b           /* Vertical Tab */
  184. #define FF           0x0c           /* Form Feed */
  185. #define CR           0x0d           /* Carriage Return */
  186. #define SO           0x0e           /* Shift Out */
  187. #define SI           0x0f           /* Shift In */
  188. #define DLE          0x10           /* Data Link Escape */
  189. #define DC1          0x11           /* Device Control 1 */
  190. #define XON          0x11           /* same as DC1 */
  191. #define DC2          0x12           /* Device Control 2 */
  192. #define DC3          0x13           /* Device Control 3 */
  193. #define XOFF         0x13           /* same as DC3 */
  194. #define DC4          0x14           /* Device Control 4 */
  195. #define NAK          0x15           /* Negative Acknowledgement */
  196. #define SYN          0x16           /* Synchronize */
  197. #define ETB          0x17           /* End of Transmission Block */
  198. #define CAN          0x18           /* Cancel */
  199. #define EM           0x19           /* End of Medium */
  200. #define SUB          0x1a           /* Substitute */
  201. #define ESC          0x1b           /* Escape */
  202. #define FS           0x1c           /* Form Separator */
  203. #define GS           0x1d           /* Group Separator */
  204. #define RS           0x1e           /* Record Separator */
  205. #define US           0x1f           /* Unit Separator */
  206.  
  207. /*END*/
  208. /*START*/
  209.  
  210.    /* XBRA vector link/unlink modes */
  211.  
  212. #define NKXM_NUM     0              /* by vector number */
  213. #define NKXM_ADR     1              /* by vector address */
  214.  
  215. /*END*/
  216. /*START*/
  217.  
  218.    /* additional flag in event mask */
  219.  
  220. #define MU_XTIMER    0x100
  221.  
  222. /*END*/
  223.  
  224.  
  225. /*******************************************************************************
  226. *                                                                              *
  227. *                                  PROTOTYPES                                  *
  228. *                                                                              *
  229. *******************************************************************************/
  230.  
  231.    /* install NKCC */
  232. int nkc_init(unsigned long flags,int vdihnd,int *pglobal);
  233.  
  234.    /* deinstall NKCC */
  235. int nkc_exit(void);
  236.  
  237.    /* set special key flags */
  238. void nkc_set(unsigned long flags);
  239.  
  240.    /* NKCC key input via GEMDOS */
  241. int nkc_conin(void);
  242.  
  243.    /* console input status via GEMDOS */
  244. int nkc_cstat(void);
  245.  
  246.    /* NKCC multi event */
  247. int cdecl nkc_multi(
  248.       int mflags,
  249.       int mbclicks,int mbmask,int mbstate,
  250.       int mm1flags,int mm1x,int mm1y,int mm1width,int mm1height,
  251.       int mm2flags,int mm2x,int mm2y,int mm2width,int mm2height,
  252.       int *mmgpbuff,
  253.       int mtlocount,int mthicount,
  254.       int *mmox,int *mmoy,int *mmbutton,int *mmokstate,
  255.       int *mkreturn,int *mbreturn);
  256.  
  257.    /* convert key code in TOS format to normalized format */
  258. int nkc_tconv(long toskey);
  259.  
  260.    /* convert key code in GEM format to normalized format */
  261. int nkc_gconv(int gemkey);
  262.  
  263.    /* convert key code in normalized format to TOS format */
  264. long nkc_n2tos(int nkcode);
  265.  
  266.    /* convert key code in normalized format to GEM format */
  267. int nkc_n2gem(int nkcode);
  268.  
  269.    /* return shift key state */
  270. int nkc_kstate(void);
  271.  
  272.    /* get 200 Hz system clock counter */
  273. unsigned long nkc_timer(void);
  274.  
  275.    /* compare two key codes due to standard comparism rules */
  276. int nkc_cmp(int refkey,int kcode);
  277.  
  278.    /* link function to XBRA vector list */
  279. void nkc_vlink(long vector,int mode,void *pfnc);
  280.  
  281.    /* unlink function from XBRA vector list */
  282. int nkc_vunlink(long vector,int mode,void *pfnc);
  283.  
  284.    /* convert character to upper case */
  285. unsigned char nkc_toupper(unsigned char chr);
  286.  
  287.    /* convert character to lower case */
  288. unsigned char nkc_tolower(unsigned char chr);
  289.  
  290.  
  291. #endif      /* #ifndef __NKCC */
  292.  
  293.  
  294. /* End Of File */
  295.